<html>
	<title>A unit test for drw.SystemUnderTest class</title>
	<head>
		<script type='text/javascript' src='../app/jsUnitCore.js'></script>
		<script type="text/javascript" src="../lib/jsUnitMockTimeout.js"></script>		

		<script type='text/javascript' src='../../jquery.js'></script>
		
<script type='text/javascript' src='../../js/data.js'></script>
<script type='text/javascript' src='../../js/da.js'></script>
<script type='text/javascript' src='../../js/util.js'></script>		
<script type='text/javascript' src='../../js/log.js'></script>		
<script type='text/javascript' src='../../js/query.js'></script>
<script type='text/javascript' src='../../js/actionHelper.js'></script>	
<script type='text/javascript' src='../../js/hnting.js'></script>	
<script type='text/javascript' src='../../js/huntMgr.js'></script>
		<script type='text/javascript'>
			function debug_log(msg) {0
				console.log(msg);
			}

			var query;
			
			// 占쎄쑴肉�占썬끉�� 
			var em = {};
			em.ahelper = new CActionHelper();
			em.ahelper.initialize();

			em.util = new CUtil();

			em.hnting = new CHnting();
			em.hnting.initialize();
			em.test = true;

var castles = [
			{"id":3070,"name":"\ucc9c\uc0c1\uc131","landtype":3,"x":185,"y":53},
			{"id":14798,"name":"\ucc9c\uc911\uc131","landtype":1,"x":184,"y":54},
			{"id":15072,"name":"\ucc9c\ud558\uc131","landtype":4,"x":188,"y":56},
			{"id":15584,"name":"\ucc9c\ud654\uc131","landtype":3,"x":188,"y":50},
			{"id":17169,"name":"\ucc9c\ud669\uc131","landtype":5,"x":184,"y":51},
			{"id":21909,"name":"\ucc9c\uacf5\uc131","landtype":3,"x":182,"y":50},
];

			 var test_da_arr = [
		
		{x:185 ,y:49},
		{x:182 ,y:56},
		// {x:149 ,y:49}, 
		// {x:183 ,y:58}, 
		];
		/*
			 var test_da_arr = [
						 {x:185 ,y:49},
		{x:149 ,y:49}, 
		{x:183 ,y:58}, 
		{x:147,y: 63}, 
		{x:155 ,y:67}, 
		{x:72 ,y:22}, 
		{x:35 ,y:27}, 
		{x:81 ,y:15}, 
		{x:192 ,y:17}, 
		{x:179 ,y:19}, 
		{x:148 ,y:16}, 
		{x:280,y:8}, 
		{x:78,y:12}, 
		{x:90,y:10}, 
		{x:87,y:12}, 
		{x:84,y:12}, 
		{x:258,y:38}, 
		{x:278,y:34}, 
		{x:86,y:29}, 
		{x:207,y:29}, 
		{x:150,y:31}, 
		{x:143,y:29}, 
		{x:146,y:32}, 
		{x:6,y:31},    
		{x:274,y:21}, 
		{x:216,y:26}, 
		{x:207,y:22}, 
		{x:152,y:22}, 
		{x:197,y:24}, 
		{x:137,y:24}, 
		{x:189,y:27}, 
		{x:65,y:47}, 
		{x:2,y:55}, 
		{x:215,y:48}, 
		{x:80,y:51}, 
		{x:239,y:59}, 
		{x:224,y:56}, 
		{x:223,y:62}, 
		{x:205,y:56}, 
		{x:195,y:59}, 
		{x:12,y:57}, 
		{x:247,y:58}, 
		{x:85,y:68}, 
		{x:266,y:50}, 
		{x:227,y:54}, 
		{x:235,y:89}, 
		{x:138,y:87}, 
		{x:230,y:87}, 
		{x:135,y:84}, 
		{x:217,y:84},     
		{x:43,y:90}, 
		{x:11,y:96}, 
		{x:277,y:84}, 
		{x:210,y:90}, 
		{x:7,y:86}, 
		{x:6,y:86}, 
		{x:4,y:82}, 
		{x:7,y:77}, 
		{x:77,y:81}, 
		{x:129,y:83}, 
		{x:3,y:80}, 
		{x:204,y:77}, 
		{x:189,y:81}, 
		{x:179,y:80}, 
		{x:83,y:76}, 
		{x:234,y:74}, 
		{x:237,y:70}, 
		{x:38,y:75}, 
		{x:15,y:73}, 
		{x:277,y:67}, 
		{x:95,y:68}, 
		{x:139,y:65}, 
		{x:187,y:64},  
		{x:164,y:127}, 
		{x:241,y:123}, 
		{x:163,y:121}, 
		{x:236,y:114}, 
		{x:68,y:115}, 
		{x:48,y:114}, 
		{x:85,y:117}, 
		{x:82,y:112}, 
		{x:132,y:135}, 
		{x:224,y:135}, 
		{x:152,y:115}, 
		{x:13,y:115}, 
		{x:183,y:113}, 
		{x:215,y:158}, 
		{x:268,y:106}, 
		{x:52,y:107}, 
		{x:233,y:108}, 
		{x:218,y:105}, 
		{x:69,y:110}, 
		{x:23,y:111}, 
		{x:148,y:111}, 
		{x:166,y:111}, 
		{x:259,y:104}, 
		{x:259,y:103}, 
		{x:72,y:104},   
		{x:63,y:98}, 
		{x:245,y:98}, 
		{x:218,y:99}, 
		{x:163,y:101}, 
		{x:70,y:95}, 
		{x:219,y:92}, 
		{x:137,y:93}, 
		{x:35,y:91}, 
		{x:207,y:96}, 
		{x:157,y:92}, 
		{x:34,y:97}, 
		{x:36,y:143}, 
		{x:30,y:139}, 
		{x:111,y:141}, 
		{x:21,y:140}, 
		{x:255,y:132}, 
		{x:250,y:133}, 
		{x:90,y:135}, 
		{x:74,y:132}, 
		{x:30,y:132}, 
		{x:90,y:128}, 
		{x:104,y:127}, 
		{x:170,y:126}, 
		{x:37,y:128},   
		{x:235,y:122}, 
		{x:186,y:110}, 
		{x:71,y:163}, 
		{x:59,y:161}, 
		{x:85,y:162}, 
		{x:35,y:163}, 
		{x:28,y:158}, 
		{x:23,y:159}, 
		{x:21,y:158}, 
		{x:13,y:151}, 
		{x:277,y:153}, 
		{x:120,y:155}, 
		{x:62,y:151}, 
		{x:57,y:157}, 
		{x:53,y:151}, 
		{x:278,y:146}, 
		{x:260,y:148}, 
		{x:239,y:150}, 
		{x:51,y:149}, 
		{x:212,y:146}, 
		{x:98,y:145}, 
		{x:96,y:148}, 
		{x:83,y:148}, 
		{x:196,y:145}, 
		{x:167,y:144}, 
		{x:237,y:139} 
						 ];*/
		
			function setUp() {
				// perform fixture set up

			}

			function tearDown() {
				// clean up
			}


		function testHntMgr() {
				// hnt action test 
	
				em.hntmgr = new CHuntMgr();
				em.hntmgr.initialize();
				// set castles 
				em.hntmgr.setCastles(castles);
				
				function mgrSuccess(){
					debug_log('success');
				};
				
				function mgrError(code){
					debug_log('Mgr error !!! ' + code);
				};
				
				function mgrNotify(da_index) {
					debug_log('mgr notify : done : '+da_index);
				};
				var autohnt_param = {
					da_arr: test_da_arr,
					cb_success: mgrSuccess,
					cb_error: mgrError,
					cb_notify: mgrNotify,
				};
				em.hntmgr.startAuto(autohnt_param);
				
				// go hnt action 
//				var	hnt = new CHuntMgr();
				//hnt.initialize();
				
				var ta_param = {
							// att param :  x, y, tr: { s : n , o : n }, success_cb , error_cb
							citnum : 14281,
							x: 222,
							y:252,
							tr: { o:200},
							success_cb : succ, 
							error_cb :   error,
				};
				
				em.hnting.setTgt(ta_param);
				em.hnting.doAttc();
				
				function succ () {
					result = true;
					complete = true;
				};

				function error(code) {
					result = false;
					errorcode = code;
					complete = true;	
					debug_log("Erro CB is called !!! in test case :" + errorcode);
					
					if(code == CHnting.NO_HERO)		{
						//move next castle.. 
						// get cityinfo, & get cdinfo 
						CHuntMgr.moveNextCasl(castles[next]);
					}	
				}				
				
				// sync call
				assertTrue(result); 
		

			};


	

		
		</script>
	</head>
	<body/>
</html>